using System;
using System.IO;

namespace AutoTest.Core.Domain
{
    public class FileChangedMessage : IEquatable<FileChangedMessage>
    {
        public FileInfo File { get; set; }

        public FileChangedMessage(FileInfo file)
        {
            File = file;
        }

        public bool Equals(FileChangedMessage other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return other.File.FullName == File.FullName;
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof(FileChangedMessage)) return false;
            return Equals((FileChangedMessage)obj);
        }

        public override int GetHashCode()
        {
            return File.FullName.GetHashCode();
        }
    }
}